package com.cx.vo;

import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 残星
 * @Description 统一返回结果集
 * @date 2022-11-30
 */
@Data
@NoArgsConstructor
public class ResultVo<T> {
    private String code;
    private String msg;
    private boolean success = false;
    private T data;
    private Integer handleCount = 0;

    public ResultVo(boolean success) {
        this.success = success;
    }

    public ResultVo<T> result(String code) {
        return result(code, null);
    }

    public ResultVo<T> result(String code, String msg) {
        return result(code, msg, null);
    }

    public ResultVo<T> result(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        return this;
    }
}
